<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>View All User</title>
<script src="references/js/jquery-2.1.0.min.js"></script>
<script src="references/js/jquery.dataTables.js"></script>
<link href="references/css/jquery.dataTables.new.css" rel="stylesheet"
	type="text/css" />

</head>
<body>
	<tiles:insertTemplate template="/pages/masterpage/masterPage.jsp">
		<tiles:putAttribute name="body">
			<logic:notEqual name="role" value="Administrator">
				<logic:forward name="home" />
			</logic:notEqual>

			<table id="myTable" style="width: 100%	">
				<thead>
					<tr>
						<th>Username</th>
						<th>Role</th>
						<th>Status</th>
						<th>Email</th>
						<th>Name</th>
						<th>ProjectId</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					<logic:iterate id="listUser" name="listUser">
						<tr>
							<td><html:link
									action="/viewUser.jms?usernameCheck=${listUser.username}">
									<bean:write name="listUser" property="username" />
								</html:link></td>
							<td><bean:write name="listUser" property="role" /></td>
							<td><bean:write name="listUser" property="stt" /></td>
							<td><bean:write name="listUser" property="email" /></td>
							<td><bean:write name="listUser" property="name" /></td>
							<td><bean:write name="listUser" property="projectId" /></td>
							
							<td><html:link styleClass="btn btn-xs btn-success"
									action="/deleteUser?usernameCheck=${listUser.username}">Delete</html:link>
								<logic:equal name="listUser" property="stt" value="1">
									<html:link styleClass="btn btn-xs btn-info"
									action="/unblockUser?usernameCheck=${listUser.username}">Unblock</html:link>
								</logic:equal>
								<logic:equal name="listUser" property="stt" value="0">
									<html:link styleClass="btn btn-xs btn-danger"
									action="/blockUser?usernameCheck=${listUser.username}">Block</html:link>
								</logic:equal>
								
								</td>
						</tr>
					</logic:iterate>
				</tbody>
			</table>
<script>
		$('#myTable').dataTable({
			"sPaginationType" : "full_numbers"

		});
</script>

		</tiles:putAttribute>
	</tiles:insertTemplate>
</body>
</html>